<template>
    <div>
        <!-- 详情页 -->
        <!-- 头部 -->
        <div id="header">
            <!-- 返回 -->
            <div class="backleft" @click="$router.history.go(-1)">
                <img src="@/assets/img/icon/backup.png">
            </div>
            <!-- 商品标题 -->
            <div class="title">{{data.pro_id}}</div>
            <!-- 刷新 -->
            <div class="fresh" @click="$router.history.go(0)">
                <img src="@/assets/img/icon/fresh.png">
            </div>
        </div>
        <!-- 主体 -->
        <div id="mainer">
            <div class="img_pic">
                <img  :src="`/${data.pic}`">
            </div>
            <!-- 标题 -->
            <div class="lot_id">
                <div>
                    <!-- 图标 -->
                    <svg t="1648974656235" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10306" width="25" height="25"><path d="M640 896h192V469.376h42.666667V896.213333c0 23.466667-19.029333 42.474667-42.666667 42.474667H597.333333V725.333333h-170.666666v213.333334H192c-23.573333 0-42.666667-18.986667-42.666667-42.453334V469.354667h42.666667V896h192V682.666667h256v213.333333z" fill="#9d9d9d" p-id="10307"></path><path d="M100.032 506.133333a21.333333 21.333333 0 1 1-29.397333-30.933333L466.282667 99.349333a66.688 66.688 0 0 1 91.434666 0L953.386667 475.2a21.333333 21.333333 0 1 1-29.397334 30.933333L528.341333 130.282667a24.021333 24.021333 0 0 0-32.682666 0L100.053333 506.133333zM832 192h-128a21.333333 21.333333 0 0 1 0-42.666667h149.333333a21.333333 21.333333 0 0 1 21.333334 21.333334v149.333333a21.333333 21.333333 0 0 1-42.666667 0V192z" fill="#9d9d9d" p-id="10308"></path></svg>
                </div>
                <div class="title">{{data.pro_id}}</div>
                <div>{{data.title}}</div>
            </div>
            <!-- 价格 -->
            <div class="price">
                <div>估价待询</div>
                <div>成交价：RMB <span>{{data.price}}</span></div>
            </div>
            <div class="mainer">
                <div :class="{cur:cur=='auction'}" @click="cur='auction'">拍品信息</div>
                <div :class="{cur:cur=='tuijian'}" @click="cur='tuijian'">为你推荐</div>
            </div>
            <!-- 拍品信息 -->
            <div>
                <auction-item :data="data"/>
            </div>
        </div>
        <!-- 尾部 -->
        <auc-footer :pid="pid"/>
    </div>
</template>

<script>
import AuctionItem from '@/components/AuctionItem.vue'
import AucFooter from '@/components/AucFooter.vue'
    export default {
        components: { AuctionItem, AucFooter },
        props:['pid'],
        data() {
            return {
                data: {}, //拍品数据
                cur:'auction' //当前项
            }
        },
        methods:{
            // 加载数据
            loadData(){
                const url=`api/product/details/${this.pid}`
                this.axios.get(url)
                .then(res =>this.data=res.data.data)
            }
        },
        mounted(){
            this.loadData()
        }
    }
</script>

<style lang="scss" scoped>
// 头部
#header {
    display: flex;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    background-color: #fff;
    height: 2.38em;
    border-bottom: 1px solid #efeef3;
    img {
        width: 30%;
    }
    .title {
        flex: 1;
        text-align: center;
    }
    // 返回
    .backleft {
        text-align: left;
    }
    // 刷新
    .fresh {
        text-align: right;
    }
    div {
        padding: 5px 10px;
    }
}
// 主体内容
#mainer {
    padding-top: 10px;
    margin-top: 2.38em;
    .img_pic {
        text-align: center;
        >img {
            max-width: 100%;
            height: 31.25vh;
        }
    }
    .lot_id {
        display: flex;
        align-items: center;
        padding: 10px;
        border-bottom: 1px solid #efeef3;
        >div {
            // 图标
            &:first-child {
                padding-right: 10px;
            }
            
        }
    }
    .price {
        padding: 10px;
        border-bottom: 1px solid #efeef3;
        >div {
            font-size: .9em;
            padding-bottom: 5px;
            span {
                padding-left: 5px;
                color: #9a4145;
                font-size: 1.3em;
            }
        }
    }
    // 菜单选择
    .mainer {
        display: flex;
        align-items: center;
        color: #969697;
        font-size: .9em;
        border-bottom: 1px solid #efefef;
        >div {
            box-sizing: border-box;
            padding: 10px 0;
            margin: 0 10px;
            &.cur {
                box-sizing: border-box;
                border-bottom: 3px solid #9a4145;
                font-weight: bold;
                color: #333;
            }
        }
    }
    
}
</style>